From 315341368cfad96ee2ceab16095403e5579c3eaf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 2 Jan 2015 13:39:30 -0800 Subject: [PATCH] Update to rust master --- .travis.install.deps.sh | 4 ++-- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 3 +++ src/bin/cargo.rs | 1 - src/cargo/core/resolver/encode.rs | 4 ++-- src/cargo/lib.rs | 1 + src/cargo/ops/cargo_rustc/custom_build.rs | 6 +++--- src/cargo/ops/cargo_rustc/mod.rs | 6 +++--- src/cargo/ops/registry.rs | 8 ++++---- src/cargo/sources/git/utils.rs | 1 + src/cargo/util/lev_distance.rs | 4 ++-- src/rustversion.txt | 2 +- 12 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.travis.install.deps.sh b/.travis.install.deps.sh index 9f0b9c281..d75a71c26 100755 --- a/.travis.install.deps.sh +++ b/.travis.install.deps.sh @@ -42,8 +42,8 @@ if [ -z "${windows}" ]; then cp -r rust-nightly-$src-$target/lib/rustlib/$src-$target \ rust-nightly-$dst-$target/lib/rustlib (cd rust-nightly-$dst-$target && \ - find lib/rustlib/$src-$target/lib -type f >> \ - lib/rustlib/manifest.in) + find lib/rustlib/$src-$target/lib -type f | sed 's/^/file:/' >> \ + manifest-rustc.in) ./rust-nightly-$dst-$target/install.sh --prefix=rustc rm -rf rust-nightly-$src-$target diff --git a/Cargo.lock b/Cargo.lock index 6e294eb3c..d8b7a8066 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,9 +3,9 @@ name = "cargo" version = "0.1.0" dependencies = [ "curl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", "log 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -34,16 +34,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -62,7 +62,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "git2" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libgit2-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -86,7 +86,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libssh2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -104,7 +104,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -121,7 +121,7 @@ name = "log" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -134,7 +134,7 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libressl-pnacl-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -153,7 +153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] diff --git a/Cargo.toml b/Cargo.toml index 922b32b66..4587eecb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,9 @@ doc = false [[test]] name = "tests" +[[bench]] +name = "tests" +path = "tests/tests.rs" [[test]] name = "resolve" diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index 7d05e9ccb..95a160fd8 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -1,5 +1,4 @@ #![feature(phase, macro_rules)] -#![deny(warnings)] extern crate "rustc-serialize" as rustc_serialize; #[phase(plugin, link)] extern crate log; diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index d9f076084..a469ed2b2 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -26,7 +26,7 @@ impl EncodableResolve { let packages = self.package.as_ref().unwrap_or(&packages); { - let register_pkg = |pkg: &EncodableDependency| { + let register_pkg = |pkg: &EncodableDependency| -> CargoResult<()> { let pkgid = try!(pkg.to_package_id(default)); let precise = pkgid.get_source_id().get_precise() .map(|s| s.to_string()); @@ -43,7 +43,7 @@ impl EncodableResolve { } { - let add_dependencies = |pkg: &EncodableDependency| { + let add_dependencies = |pkg: &EncodableDependency| -> CargoResult<()> { let package_id = try!(pkg.to_package_id(default)); let deps = match pkg.dependencies { diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 9a6768500..d20f5dcf2 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -2,6 +2,7 @@ #![crate_type="rlib"] #![feature(macro_rules, phase, default_type_params, unboxed_closures)] +#![feature(slicing_syntax)] #![deny(unused)] #![cfg_attr(test, deny(warnings))] diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index f34fb26fd..08d5f0429 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -106,7 +106,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, // // Note that this has to do some extra work just before running the command // to determine extra environment variables and such. - let work = move |: desc_tx: Sender| { + let work = move |: desc_tx: Sender| -> CargoResult<()> { // Make sure that OUT_DIR exists. // // If we have an old build directory, then just move it into place, @@ -122,7 +122,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, // along to this custom build command. let mut p = p; { - let build_state = build_state.outputs.lock(); + let build_state = build_state.outputs.lock().unwrap(); for &(ref name, ref id) in lib_deps.iter() { let data = &build_state[(id.clone(), kind)].metadata; for &(ref key, ref value) in data.iter() { @@ -226,7 +226,7 @@ impl BuildState { fn insert(&self, id: PackageId, req: Platform, output: BuildOutput) { - let mut outputs = self.outputs.lock(); + let mut outputs = self.outputs.lock().unwrap(); match req { Platform::Target => { outputs.insert((id, Kind::Target), output); } Platform::Plugin => { outputs.insert((id, Kind::Host), output); } diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index b31d77d20..f563f1e28 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -178,7 +178,7 @@ pub fn compile_targets<'a>(env: &str, targets: &[&'a Target], pkg: &'a Package, let out_dir = cx.layout(pkg, Kind::Target).build_out(pkg) .display().to_string(); cx.compilation.extra_env.insert("OUT_DIR".to_string(), Some(out_dir)); - for (&(ref pkg, _), output) in cx.build_state.outputs.lock().iter() { + for (&(ref pkg, _), output) in cx.build_state.outputs.lock().unwrap().iter() { let any_dylib = output.library_links.iter().any(|l| { !l.ends_with(":static") && !l.ends_with(":framework") }); @@ -290,7 +290,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, let kind = match req { Platform::Plugin => Kind::Host, _ => Kind::Target }; let key = (pkg.get_package_id().clone(), kind); if pkg.get_manifest().get_links().is_some() && - cx.build_state.outputs.lock().contains_key(&key) { + cx.build_state.outputs.lock().unwrap().contains_key(&key) { continue } let (dirty, fresh, freshness) = @@ -481,7 +481,7 @@ fn rustc(package: &Package, target: &Target, // Only at runtime have we discovered what the extra -L and -l // arguments are for native libraries, so we process those here. { - let build_state = build_state.outputs.lock(); + let build_state = build_state.outputs.lock().unwrap(); for id in native_lib_deps.into_iter() { let output = &build_state[(id.clone(), kind)]; for path in output.library_paths.iter() { diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index e793a06ca..b76415d57 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -1,12 +1,13 @@ use std::collections::HashMap; use std::io::File; use std::io::fs::PathExtensions; +use std::iter::repeat; use std::os; -use term::color::BLACK; use curl::http; use git2; use registry::{Registry, NewCrate, NewCrateDependency}; +use term::color::BLACK; use core::source::Source; use core::{Package, MultiShell, SourceId}; @@ -371,9 +372,8 @@ pub fn search(query: &str, shell: &mut MultiShell, index: Option) -> Car for (name, description) in list_items.into_iter() { let line = match description { Some(desc) => { - let space = String::from_char( - description_margin - name.len(), - ' '); + let space = repeat(' ').take(description_margin - name.len()) + .collect::(); name.to_string() + space.as_slice() + desc.as_slice() } None => name diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 33a0e06ba..1f6c0aed8 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -366,6 +366,7 @@ fn with_authentication(url: &str, cred_helper.config(cfg); let mut cred_error = false; let ret = f(&mut |&mut: url, username, allowed| { + let username = if username.is_empty() {None} else {Some(username)}; let creds = if allowed.contains(git2::SSH_KEY) { let user = username.map(|s| s.to_string()) .or_else(|| cred_helper.username.clone()) diff --git a/src/cargo/util/lev_distance.rs b/src/cargo/util/lev_distance.rs index 24e988374..d37a22791 100644 --- a/src/cargo/util/lev_distance.rs +++ b/src/cargo/util/lev_distance.rs @@ -14,7 +14,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint { if me.is_empty() { return t.chars().count(); } if t.is_empty() { return me.chars().count(); } - let mut dcol = Vec::from_fn(t.len() + 1, |x| x); + let mut dcol = range(0, t.len() + 1).collect::>(); let mut t_last = 0; for (i, sc) in me.chars().enumerate() { @@ -47,7 +47,7 @@ fn test_lev_distance() { // Test bytelength agnosticity for c in range(0u32, MAX as u32) .filter_map(|i| from_u32(i)) - .map(|i| String::from_char(1, i)) { + .map(|i| i.to_string()) { assert_eq!(lev_distance(c[], c[]), 0); } diff --git a/src/rustversion.txt b/src/rustversion.txt index 8cbc9fc6e..128b79ec5 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2014-12-30 +2015-01-02 -- 2.30.2